<template>
  <div>
    <MyHeader title="购物车案例"></MyHeader>
    <MyGoods v-for="item in list" :key="item.id" :obj="item"></MyGoods>
    <MyFooter :arr="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";
import axios from "axios";
export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    async getList() {
      const { data } = await axios.get(" https://www.escook.cn/api/cart");
      this.list = data.list;
    },
  },
};
</script>

<style>
</style>